home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 1
/
Cream of the Crop 1.iso
/
WINDOWS
/
WB_33C.ARJ
/
@NETTEST.WB$
next >
Wrap
Text File
|
1992-05-21
|
22KB
|
517 lines
; Network Investigator.
; This WBT file is an attempt to throw various WinBatch and WinBatch Network
; Extender commands at a network, keep track of results, and make a report.
; The problem being that there are so many networks, and versions of
; networks that a generic command set as implemented by WinBatch must be
; able to at least survive any conceivable contingency.
; With older version of products, the ability of this WBT file to survive
; all errors is compromised. It actually runs best with unreleased
; versions of WinBatch. But such is life. We still need feedback to
; make it better.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; First we initialize a few variable we use here and there
; Secondary Server is used to try NetAttach/NetLogin/NetLogout commands
; You may wish to modify the code to actually login, etc to these servers
SecServer="XYZZY"
RsltFile=strcat(DirGet(),"NETRSLT.TXT") ; Get fully qual file name
ErrorMode(@off)
FileDelete(RsltFile) ; Delete it
ErrorMode(@Cancel)
Debug(0)
Results=""
CR=strcat(num2char(13),num2char(10))
NI="Network Investigator"
N0="No"
N256="MSNetwork"
N512="LanManager"
N768="Novell"
N1024="BanyanVines"
N1280="10Net"
Rslt0="FAILED"
Rslt1="PASSED"
NOT0="not "
NOT1=""
YesNo0="NO"
YesNo1="YES"
OhNo=0
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Now set set a flag for each command to keep track of whether or
; not it worked. Initialize all flags to untested.
XNetMapRoot=2
XNetMsgAll=2
XNetMsgSend=2
XNetLogin=2
XNetLogout=2
XNetMemberGet=2
XNetMemberSet=2
XNetAttach=2
XNetDetach=2
XNetAddCon=2
XNetCancelCon=2
XNetGetCon=2
XNetBrowse=2
XNetDialog=2
XNetGetCaps=2
XNetGetUser=2
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; First we try to figure out if the current Command Extender is a
; Wilson WindowWare or a NDW product
ExtManu="?? NO ??"
ExtName=strupper(IntControl(10,3,0,0,0))
if ExtName=="WWWDNETX.DLL" then EC="W"
then ExtManu="WWW" ; Extender by Wilson WindowWare
if ExtName=="COMMEXT.DLL" then EC="N"
then ExtManu="NDW" ; Extender by Symantec/Peter Norton
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Prompt for server name. Remember what it is.
Msg1="Please run this batch file, and then%CR%look at the NETRSLT.TXT file."
Msg1=strcat(Msg1,CR,"Enter name of file server")
Serverx=IniReadPvt(NI,"Server","","WWW-PROD.INI")
Server=AskLine("%NI% using %ExtManu% extender",Msg1,Serverx)
if Server!=Serverx then IniWritePvt(NI,"Server",Server,"WWW-PROD.INI")
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; First of all, check for presence and/or proper installation of extender DLL
; and related pertainent data
a=IntControl(10,0,0,0,0)
if a==1 then Results="Network Command Extender found"
else Results="No Command Extender Found"
else goto showinfo
a=IntControl(10,1,0,0,0)
if a==0 then Results=strcat(Results,CR,"But it is not compatible")
then goto showinfo
else Results=strcat(Results,CR,"Extender Ver %a%")
a=IntControl(10,2,0,0,0)
Results=strcat(Results," ","Interface Ver %a%")
Results=strcat(Results,CR,"Extender file is %ExtName% by %ExtManu%")
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; This is out First NetGetCaps command. Be ready to recover.
; We have a *lot* of extra code around the net commands the first time
; we execute each one so that if the command is flat out not supported by
; your network, at least the batch file continues to run.
; We will just comment the extra stuff once here to let you know what is
; going on
LastError() ; Make sure current error code = 0
TestNet="NetGetCaps" ; Set a variable so we're testing
ErrorMode(@OFF) ; Disable errors
NetNum=NetGetCaps(2) ; Do the network command
ErrorMode(@CANCEL) ; Re-enable errors
e=LastError() ; Capture the last error code
If e==1175 then XNetGetCaps=0 ; If it was 1175, then unsupported command
then goto showinfo ; NO NetGetCaps? Give up, print report
if e!=0 then goto UHOH ; Other error occurred. Give up
XNetGetCaps=1 ; NetGetCaps supported
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Based on the results of the NetGetCaps command, determine what kind
; of network we have here
NetName="Other"
if IsDefined(N%NetNum%) then NetName=N%NetNum%
then Results=strcat(Results,CR,NetName," Network Installed")
else Results=strcat(Results,CR,"Unknown network installed")
if NetNum==0 then goto ShowInfo ; No network. Go home
; Pick out some available generic info. Sometimes these numbers look
; better in HEX
Results=strcat(Results,CR,"Net Driver Spec Number: ",NetGetCaps(1))
Results=strcat(Results,CR,"Net Driver Version Number: ",NetGetCaps(3))
; What kind of connection support does this network support
a=NetGetCaps(6)
Results=strcat(Results,CR,"Connection Support: (%a%) ")
if a&1 then Results=strcat(Results,"Add ")
then XNetAddCon=1
if a&2 then Results=strcat(Results,"Can ")
then XNetCancelCon=1
if a&4 then Results=strcat(Results,"Get ")
then XNetGetCon=1
if a&8 then Results=strcat(Results,"Auto ")
if a&16 then Results=strcat(Results,"Browse ")
then XNetBrowse=1
; And what kind of print support is there
a=NetGetCaps(7)
Results=strcat(Results,CR,"Print Support: (%a%) " )
if a&2 then Results=strcat(Results,"Open ")
if a&4 then Results=strcat(Results,"Close ")
if a&16 then Results=strcat(Results,"Hold ")
if a&32 then Results=strcat(Results,"Rlse ")
if a&64 then Results=strcat(Results,"Can ")
if a&128 then Results=strcat(Results,"Copies ")
if (a>255) then Results=strcat(Results,CR," ")
if a&256 then Results=strcat(Results,"Watch ")
if a&512 then Results=strcat(Results,"UnWatch ")
if a&1024 then Results=strcat(Results,"Lock ")
if a&2048 then Results=strcat(Results,"Unlock ")
if a&4096 then Results=strcat(Results,"QNotify ")
if a&8192 then Results=strcat(Results,"Abort ")
;;;;;;;;;;; Check for required files, etc here ;;;;;;;;;;;;
; Now that we've determined what brand-name extender we have and
; what kind of network we're talking to, make sure the required
; files for that particular combination are present on this system.
:CheckDaFiles
dll=ExtName
if !FileExist(dll) then Results=strcat(Results,CR,"Required File Missing -->",dll)
goto X%NetName% ;Wow! a computed goto
:XMSNetwork
; No idea what files this network needs...
goto filchkdone
:XLanManager
dll="%EC%LANMAN.DLL"
if !FileExist(dll) then Results=strcat(Results,CR,"Required File Missing -->",dll)
dll="NETAPI.DLL"
if !FileExist(dll) then Results=strcat(Results,CR,"Required File Missing -->",dll)
goto filchkdone
:XNovell
dll="%EC%NOVELL.DLL"
if !FileExist(dll) then Results=strcat(Results,CR,"Required File Missing -->",dll)
dll="NWCONN.DLL"
if !FileExist(dll) then Results=strcat(Results,CR,"Required File Missing -->",dll)
dll="NWCORE.DLL"
if !FileExist(dll) then Results=strcat(Results,CR,"Required File Missing -->",dll)
dll="NWMISC.DLL"
if !FileExist(dll) then Results=strcat(Results,CR,"Required File Missing -->",dll)
goto filchkdone
:XBanyanVines
dll="%EC%BANYAN.DLL"
if !FileExist(dll) then Results=strcat(Results,CR,"Required File Missing -->",dll)
dll="VNSAPI.DLL"
if !FileExist(dll) then Results=strcat(Results,CR,"Required File Missing -->",dll)
goto filchkdone
:X10Net
dll="%EC%10NET.DLL"
if !FileExist(dll) then Results=strcat(Results,CR,"Required File Missing -->",dll)
goto filchkdone
:XOther
NetInfo=AskLine(NI,"Hmmm. Unfamiliar network. Please enter Network type and version number","")
Results=strcat(Results,CR,"NetInfo: ",NetInfo)
goto filchkdone
:filchkdone
; If any files missing, go home.
a=Strindex(Results,"File Missing",0,@FWDSCAN)
if a!=0 then goto showinfo
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; OK so far we survived the NetGetCaps command and verified the presence
; all required files to make this thing work.
; Now we try the infamous NetGetUser function.
LastError() ; Make sure current error code = 0
TestNet="NetGetUser" ; Set a variable so we're testing
ErrorMode(@OFF) ; Disable errors
UserName=NetGetUser() ; Do the network command
ErrorMode(@CANCEL) ; Re-enable errors
e=LastError() ; Capture the last error code
XNetGetUser=0 ; Set support code to 0
if (e!=0 && e!=1175) then goto UHOH ; Other error occurred. Give up
if e==0 then XNetGetUser=1 ; GetUserName supported
else UserName="<UNSUPTD>" ; Make up a user name
Results=strcat(Results,CR,"Server name = %Server% UserName = %UserName%")
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; OK, now we try the NetMsgSend command to ourself.
Message("Starting NetMsgSend Test","Clear any pending net messages now")
LastError() ; Clear last error if any
TestNet="NetMsgSend" ; Command under observation
ErrorMode(@OFF) ; Disable errors
; and the command in question
a=NetMsgSend(Server,UserName,"Network Test. Please ignore this message")
ErrorMode(@CANCEL) ; Re-enable errors
Delay(3) ; Let them hit OK
e=LastError() ; Look at last error
XNetMsgSend=0 ; Set support code to 0
if (e!=0 && e!=1213) then goto UHOH ; NON-1213 error occurred
If e==0 then XNetMsgSend=1 ; It's supported
else a=0 ; Hmmm 1213 error, fail this command
Results=strcat(Results,CR,"NetMsgSend to current server ",Rslt%a%)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; OK, now we try the NetMsgAll command to everybody (and second cousins).
Message("Starting NetMsgAll Test","Clear any pending net messages now")
LastError() ; The usual
TestNet="NetMsgAll" ; Looking at NetMsgAll now
ErrorMode(@OFF) ; Disable errors
; Alternate message by soon-to-be former employee commented out
;a=NetMsgAll(Server,"Help! I'm locked in the net room. Plz call security!")
; Try NetMsgAll
a=NetMsgAll(Server,"Network Testing. Please ignore this message.")
Delay(3) ; Let them hit OK
ErrorMode(@CANCEL) ; Re-enable errors
e=LastError()
XNetMsgAll=0 ; Set support code to 0
if (e!=0 && e!=1213) then goto UHOH ; Ooop....unknown error...byebye
If e==1213 then a=0
else XNetMsgAll=1 ; NetMsgAll supported, but does it work
Results=strcat(Results,CR,"NetMsgAll to current server ",Rslt%a%)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Now we take a whack at the "NetMemberGet" command
LastError() ; Clear last error flag
TestNet="NetMemberGet" ; Today, class, we're testing NMG
ErrorMode(@OFF) ; Disable errors
a=NetMemberGet(Server,"NOBODYATALL") ; Well, is current user a member of...
ErrorMode(@CANCEL) ; re-enable errors
XNetMemberGet=0 ; Set support code to 0
e=LastError() ; Get Last Error
if (e!=0 && e!=1213) then goto UHOH ; Ooops. Gotta run...bye
If e==1213 then Results=strcat(Results,CR,"NetMemberGet unsupported")
else XNetMemberGet=1 ; Command apparently supported
else Results=strcat(Results,CR,"User %UserName% is ",NOT%A%,"a member of group NOBODYATALL")
else a=NetMemberGet(Server,"EVERYONE") ; Lets try again for those Novell fellows
else Results=strcat(Results,CR,"User %UserName% is ",NOT%A%,"a member of group EVERYONE")
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Now we take a whack at the "NetMapRoot" command
if NetNum!=768 then goto NA ; Only try this on Novell networks
a=AskYesNo(NI,"Shall we try a NetMapRoot command?%CR%Choose ""NO"" if it failed last time")
if a==@NO then goto NA
; First, grab an available local drive
a=DiskScan(0) ; Get list of unassigned drives
if strlen(a)<3 then message(NI,"No local drives avail to test NetMapRoot")
then goto NA
locdrv=strsub(a,1,2) ; Get a local drive
if XNetBrowse==0 then message(NI,"Cannot browse net to test NetMapRoot")
then goto NA
Message(NI,"After this message, choose a net directory%CR%to try a NetMapRoot command on")
path=NetBrowse(0)
if path=="" then message(NI,"No net dir selected, bypassing NetMapRoot Test")
LastError() ; Clear error codes
TestNet="NetMapRoot" ; Working on NetMapRoot now
ErrorMode(@OFF) ; Disable errors
a=NetMapRoot(locdrv,path) ; Try NetMapRoot
ErrorMode(@CANCEL) ; Re-enable errors
XNetMapRoot=0 ; Set support code to 0
e=LastError() ; get last error code
if (e!=0 && e!=1213) then goto UHOH ; Ooop. Bye
If e==1213 then a=0 ; Not supported/failed
else XNetMapRoot=1 ; Supported
Results=strcat(Results,CR,"NetAttach to server %SecServer% ",Rslt%a%)
; Kill above connection
if (XNetCancelCon==0 && a==1) then Message(NI,"Cannot undo NetMapRoot due to%CR%unsupported NetCancelCon command")
then goto NA
if a==1 then NetCancelCon(locdrv,0)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Now we take a whack at the "NetAttach" command
:NA
LastError() ; Clear error codes
TestNet="NetAttach" ; Working on NetAttach now
ErrorMode(@OFF) ; Disable errors
a=NetAttach(SecServer) ; Attempt attach to another server
ErrorMode(@CANCEL) ; Re-enable errors
XNetAttach=0 ; Set Support code to 0
e=LastError() ; get last error code
if (e!=0 && e!=1213) then goto UHOH ; Ooop. Bye
If e==1213 then a=0 ; Not supported/failed
else XNetAttach=1 ; Supported
Results=strcat(Results,CR,"NetAttach to server %SecServer% ",Rslt%a%)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Now we take a whack at the "NetLogin" command
LastError() ; Clear error codes
TestNet="NetLogin" ; Working on NetLogin now
ErrorMode(@OFF) ; Disable errors
a=NetLogin(SecServer,UserName,"") ; Attempt login to new server
ErrorMode(@CANCEL) ; Re-enable errors
XNetLogin=0 ; Set support code to 0
e=LastError() ; get last error code
if (e!=0 && e!=1213) then goto UHOH ; Ooop. Bye
If e==1213 then a=0 ; Not supported/failed
else XNetLogin=1 ; Supported
Results=strcat(Results,CR,"NetLogin to %SecServer% ",Rslt%a%)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Now we take a whack at the "NetLogout" command
LastError() ; Clear error codes
TestNet="NetLogout" ; Working on NetLogout now
ErrorMode(@OFF) ; Disable errors
a=NetLogout(SecServer) ; Attempt logout from new server
ErrorMode(@CANCEL) ; Re-enable errors
e=LastError() ; get last error code
XNetLogout=0 ; Set support code to 0
if (e!=0 && e!=1213) then goto UHOH ; Ooop. Bye
If e==1213 then a=0 ; Not supported/failed
else XNetLogout=1 ; Supported
Results=strcat(Results,CR,"NetLogout from %SecServer% ",Rslt%a%)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Now we take a whack at the "NetDetach" command
LastError() ; Clear error codes
TestNet="NetDetach" ; Working on NetDetach now
ErrorMode(@OFF) ; Disable errors
a=NetDetach(SecServer) ; Attempt detach from non-exist server
ErrorMode(@CANCEL) ; Re-enable errors
e=LastError() ; get last error code
XNetDetach=0 ; Set support code to 0
if (e!=0 && e!=1213) then goto UHOH ; Ooop. Bye
If e==1213 then a=0 ; Not supported/failed
else XNetDetach=1 ; Supported
Results=strcat(Results,CR,"NetDetach from server %SecServer% ",Rslt%a%)
goto showinfo
:UHOH
:CANCEL
Message("Error %e%","Occurred near testing for %TestNet%")
Results=strcat(Results,CR,"Error %e% occurred with %TestNet%")
OhNo=1
:showInfo
Message("Network Investigator",Results)
Support="SUPPORTED FUNCTIONS%CR%"
if XNetMapRoot== 1 then Support=strcat(Support,CR,"NetMapRoot")
if XNetMsgAll== 1 then Support=strcat(Support,CR,"NetMsgAll")
if XNetMsgSend== 1 then Support=strcat(Support,CR,"NetMsgSend")
if XNetLogin== 1 then Support=strcat(Support,CR,"NetLogin")
if XNetLogout== 1 then Support=strcat(Support,CR,"NetLogout")
if XNetMemberGet==1 then Support=strcat(Support,CR,"NetMemberGet")
if XNetMemberSet==1 then Support=strcat(Support,CR,"NetMemberSet")
if XNetAttach== 1 then Support=strcat(Support,CR,"NetAttach")
if XNetDetach== 1 then Support=strcat(Support,CR,"NetDetach")
if XNetAddCon== 1 then Support=strcat(Support,CR,"NetAddCon")
if XNetCancelCon==1 then Support=strcat(Support,CR,"NetCancelCon")
if XNetGetCon== 1 then Support=strcat(Support,CR,"NetGetCon")
if XNetBrowse== 1 then Support=strcat(Support,CR,"NetBrowse")
if XNetDialog== 1 then Support=strcat(Support,CR,"NetDialog")
if XNetGetCaps== 1 then Support=strcat(Support,CR,"NetGetCaps")
if XNetGetUser== 1 then Support=strcat(Support,CR,"NetGetUser")
Support=strcat(Support,CR,CR,"NON-SUPPORTED FUNCTIONS",CR)
if XNetMapRoot== 0 then Support=strcat(Support,CR,"NetMapRoot")
if XNetMsgAll== 0 then Support=strcat(Support,CR,"NetMsgAll")
if XNetMsgSend== 0 then Support=strcat(Support,CR,"NetMsgSend")
if XNetLogin== 0 then Support=strcat(Support,CR,"NetLogin")
if XNetLogout== 0 then Support=strcat(Support,CR,"NetLogout")
if XNetMemberGet==0 then Support=strcat(Support,CR,"NetMemberGet")
if XNetMemberSet==0 then Support=strcat(Support,CR,"NetMemberSet")
if XNetAttach== 0 then Support=strcat(Support,CR,"NetAttach")
if XNetDetach== 0 then Support=strcat(Support,CR,"NetDetach")
if XNetAddCon== 0 then Support=strcat(Support,CR,"NetAddCon")
if XNetCancelCon==0 then Support=strcat(Support,CR,"NetCancelCon")
if XNetGetCon== 0 then Support=strcat(Support,CR,"NetGetCon")
if XNetBrowse== 0 then Support=strcat(Support,CR,"NetBrowse")
if XNetDialog== 0 then Support=strcat(Support,CR,"NetDialog")
if XNetGetCaps== 0 then Support=strcat(Support,CR,"NetGetCaps")
if XNetGetUser== 0 then Support=strcat(Support,CR,"NetGetUser")
Support=strcat(Support,CR,CR,"UNTESTED FUNCTIONS",CR)
if XNetMapRoot== 2 then Support=strcat(Support,CR,"NetMapRoot")
if XNetMsgAll== 2 then Support=strcat(Support,CR,"NetMsgAll")
if XNetMsgSend== 2 then Support=strcat(Support,CR,"NetMsgSend")
if XNetLogin== 2 then Support=strcat(Support,CR,"NetLogin")
if XNetLogout== 2 then Support=strcat(Support,CR,"NetLogout")
if XNetMemberGet==2 then Support=strcat(Support,CR,"NetMemberGet")
if XNetMemberSet==2 then Support=strcat(Support,CR,"NetMemberSet")
if XNetAttach== 2 then Support=strcat(Support,CR,"NetAttach")
if XNetDetach== 2 then Support=strcat(Support,CR,"NetDetach")
if XNetAddCon== 2 then Support=strcat(Support,CR,"NetAddCon")
if XNetCancelCon==2 then Support=strcat(Support,CR,"NetCancelCon")
if XNetGetCon== 2 then Support=strcat(Support,CR,"NetGetCon")
if XNetBrowse== 2 then Support=strcat(Support,CR,"NetBrowse")
if XNetDialog== 2 then Support=strcat(Support,CR,"NetDialog")
if XNetGetCaps== 2 then Support=strcat(Support,CR,"NetGetCaps")
if XNetGetUser== 2 then Support=strcat(Support,CR,"NetGetUser")
if OhNo==0 then Message("Function support for this network installation",Support)
fp=FileOpen(RsltFile,"WRITE")
FileWrite(fp,"Please mail or upload this file to:")
FileWrite(fp,"Wilson WindowWare, Inc.
FileWrite(fp,"2701 California SW #212 CIS 73260,2535")
FileWrite(fp,"Seattle, WA 98116 BBS (206) 935-5198")
FileWrite(fp,"- - - - - - - - - - - - - - - - - - - - - - - - - - - - -")
FileWrite(fp," ")
FileWrite(fp,Results)
FileWrite(fp," ")
FileWrite(fp,"_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _")
if OhNo==0 then FileWrite(fp,Support)
FileClose(fp)
exit